
function AutoScroll(obj) {
    $(obj).find("ul:first").animate({
            marginTop: "-45px"
        },
        1000
        ,
        function() {
            $(this).css({
                marginTop: "0px"
            }).find("li:first").appendTo(this);
        }
    );
}
$(document).ready(function () {
    /*
     *banner
     */
    var bannerUrl = global.localhost+"Api/New/get_banner";
    $.ajax({
        url:bannerUrl,
        async:false,
        dataType:"json",
        success:function (res) {
            console.log(res)
                var html = '';
                for(var i=0;i<res.length;i++){
                    html += '<li class="carousel-item">';
                    html += '<a href="'+res[i].title+'">';
                    html += '<img src="'+res[i].banner_img+'" />';
                    html += '</a>';
                    html += '</li>';
                }
                $(".carousel-inner").html(html);
        }
    })
    $("#carousel_1").FtCarousel();
    var mediaUrl = global.localhost+"Api/New/first_hydt_three";
    sendAjax(mediaUrl,function (res) {
        var html = "";
        for(var i=0;i<res.length;i++){
            html += '<li>';
            html += '<a href="news-details.html?item=1&id='+res[i].id+'">'+res[i].title+'</a>'
            html += '</li>';
        }
        $(".ad-list").html(html);
    })
    var groupNewsUrl = global.localhost+"Api/New/first_jtxw_three"
    sendAjax(groupNewsUrl,function (res) {
        var dataTime = res[0].date.split(".");
        var html = '';
        html += '<a href="news-details-bak.html?item=0&id='+res[0].id+'">';
        html += '<p class="time">'+dataTime[0]+'年'+dataTime[1]+'月'+dataTime[2]+'日</p>';
        html += ' <p class="title">'+res[0].title+'</p>';
        html += ' <p class="content">'+res[0].sub_content+'</p>';
        html += '</a>';
        var html01 = "";
        for(var i=1;i<res.length;i++){
            var dataTime = res[i].date.split(".");
            html01 += '<li><a href="news-details-bak.html?item=0&id='+res[i].id+'"><span class="title">'+res[i].title+'</span><span class="time">'+dataTime[0]+'年'+dataTime[1]+'月'+dataTime[2]+'日</span></a></li>'
        }
        $(".headline-news").html(html);
        $(".news-list").html(html01);
    })



    setInterval('AutoScroll("#ad-container")',3000);
})
